<template>
	<view class="wrap">
		<u-gap height="20" bg-color="#f5f5f5"></u-gap>
		<u-cell-group :border="false" :customStyle="{backgroundColor: '#FFFFFF'}">
			<u-cell title="通用" @click="navTo('/pages/user/currency')" :isLink="true"></u-cell>
      <u-cell title="清除缓存" @click="navTo('clear-cache')" :isLink="true"></u-cell>
      <u-gap height="10" bgColor="#f5f5f5"></u-gap>
			<u-cell title="版本更新"  @click="navTo('')" :isLink="true"></u-cell>
			<u-cell title="隐私政策" @click="navTo('')" :isLink="true"></u-cell>
			<u-cell title="用户协议" @click="navTo('')" :isLink="true"></u-cell>
		</u-cell-group>
		<u-gap height="10" bg-color="#f5f5f5"></u-gap>
		<view>
			<u-button class="sign-out"  @click="logout" :hair-line="false">退出登录</u-button>
		</view>
	</view>
</template>

<script>
/**
 * Copyright (c) 2020-Now http://www.future.com All rights reserved.
 */
export default {
	data() {
		return {

		}
	},
	methods: {
    navTo(url) {uni.navigateTo({	url: url});},
		openSettings() {
			// #ifdef APP-PLUS
			uni.getSystemInfo({
				success(res) {
					if(res.platform == 'ios'){
						plus.runtime.openURL("app-settings://");
					} else if (res.platform == 'android'){
						var main = plus.android.runtimeMainActivity();
						var Intent = plus.android.importClass("android.content.Intent");
						var mIntent = new Intent('android.settings.SOUND_SETTINGS');
						main.startActivity(mIntent);
					}
				}
			});
			// #endif
			// #ifndef APP-PLUS
			this.$u.toast('小程序端或H5端已是最新版，无需检查更新！');
			// #endif
		},
		logout() {
      this.$store.dispatch('LogOut',{params: {}, custom: { auth: true,toast: true }}).then(() => {
        setTimeout(() => {	uni.reLaunch({	url: '/pagework/login/index'});	}, 500)
      }).catch(() => {

      })
		},
    upgrade(){
			// #ifdef APP-PLUS
			this.$u.api.upgradeCheck().then(res => {
				if (res.result == 'true'){
					uni.showModal({
						title: '提示',
						content: res.message + '是否下载更新？',
						showCancel: true,
						success: function (res2) {
							if (res2.confirm) {
								plus.runtime.openURL(res.data.apkUrl);
							}
						}
					});
				}else{
					this.$u.toast(res.message);
				}
			});
			// #endif
			// #ifndef APP-PLUS
			this.$u.toast('小程序端或H5端无需检查更新')
			// #endif
		}
	}
};
</script>
<style lang="scss">


  page {
    background-color: $u-f-pg-bg-color;
  }
 .u-cell-title {
    padding: 25rpx 30rpx;
    font-size: 30rpx;
  }
  .sign-out{
    margin:0;
    border-radius: 0;
    border: 0!important;
    color: #ff4141!important;
    background: #fff;
  }
</style>
